package com.jrj.base;

import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;

import com.jrj.service.CustomerRoutingDataSourceService;



/**
 *@author zhiming.li
 *@version createTime：2011-12-23 下午01:59:11
 */
public class CustomerRoutingDataSourceInterceptor implements MethodInterceptor{

	@Override
	public Object invoke(MethodInvocation arg0) throws Throwable {
		Object obj = arg0.getThis();
		if (obj instanceof CustomerRoutingDataSourceService) {
			CustomerRoutingDataSourceService service = (CustomerRoutingDataSourceService) obj;
			CustomerContextHolder.setCustomerType(service.getCustomerType());
		}
		return arg0.proceed();
		
	}

}
